from charlotte.utils import jsonify
from charlotte import M

shop = M.Router('/shop')

@shop.get('/{id:int}')
def get_product(ctx, request):
    return jsonify(id=request.vars.id)
    #return M.Response('product {}'.format(request.vars.id))


if __name__ == '__main__':
    app = M()
    app.register(shop)
    from wsgiref.simple_server import make_server
    server = make_server('0.0.0.0', 3000, app)
    try:
        server.serve_forever()
    except KeyboardInterrupt:
        server.shutdown()